package com.cloud.tsp.controller;

import com.cloud.core.util.R;
import com.cloud.api.domain.stats.OfflineVehicleVo;
import com.cloud.api.domain.stats.VehicleStats;
import com.cloud.api.domain.sys.DictTypeQuery;
import com.cloud.api.domain.tsp.*;
import com.cloud.api.validgroup.ValidateGroupSelectVin;
import com.cloud.api.constants.StrVo;
import com.cloud.log.annotation.Log;
import com.cloud.log.enums.BusinessType;
import com.cloud.log.enums.OperatorType;
import com.cloud.mybatis.domain.PageModelNew;
import com.cloud.mybatis.domain.TableDataInfo;
import com.cloud.tsp.service.IVehicleMessageDailyService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 * OLAP 前端控制器
 * </p>
 *
 * @author haohaibo
 * @since 2023-12-01
 */
@RestController
@RequestMapping("/vehicle-message-daily")
public class VehicleMessageDailyController {

    @Resource
    private IVehicleMessageDailyService vehicleMessageDailyService;


    /*@Tag(name = "v1.0")
    @Operation(summary = "查询车辆实时位置（管理）")
    @PostMapping("/getVehicleLocation")
    @Log(title = "实时监控-查询车辆实时位置", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R<VehicleLocation> selectVehicleLocation(@RequestBody @Valid StrVo para){
        return R.ok(vehicleMessageDailyService.selectVehicleLocation(para.getId()));
    }*/

    /*@Tag(name = "v1.0")
    @Operation(summary = "查询车辆vin(土耳其  位置管理)")
    @PostMapping("/getVinList")
    @Log(title = "实时监控-查询车辆vin", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public TableDataInfo<VinLockStatus> selectVinList(@Validated(ValidateGroupSelectVin.class) @RequestBody @Valid QueryVehicle para) throws IOException {
        return vehicleMessageDailyService.selectVinList(para);
    }*/

    /*@Tag(name = "v1.0")
    @Operation(summary = "查询车辆vin( tsp位置管理)")
    @PostMapping("/getVinListTsp")
    @Log(title = "实时监控-查询车辆vin", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public TableDataInfo<VinLockStatus> selectVinListTsp(@Validated(ValidateGroupSelectVin.class) @RequestBody @Valid QueryVehicle para) throws IOException {
        return vehicleMessageDailyService.selectVinListTsp(para);
    }*/

    @Tag(name = "v1.0")
    @Operation(summary = "查询总上线车辆数( tsp首页统计)")
    @PostMapping("/getOnlineVehicleCount")
    @Log(title = "首页-查询总上线车辆数", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R<VehicleStats> selectOnlineVehicleCount(){
        return R.ok(vehicleMessageDailyService.selectOnlineVehicleCount());
    }

    @Tag(name = "v1.0")
    @Operation(summary = "查询离线车辆统计(管理)")
    @PostMapping("/getOfflineVehicle")
    @Log(title = "统计分析-查询离线车辆统计", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public TableDataInfo<OfflineVehicleVo> selectOfflineVehicle(@RequestBody @Valid DictTypeQuery para) throws IOException {
        return vehicleMessageDailyService.selectOfflineVehicle(para);
    }

    @Tag(name = "v1.0")
    @Operation(summary = "导出离线车辆统计(管理)")
    @PostMapping("/exportOfflineVehicle")
    @Log(title = "统计分析-导出离线车辆统计", businessType = BusinessType.EXPORT, operatorType = OperatorType.MANAGE)
    public void exportOfflineVehicle(DictTypeQuery para, HttpServletResponse response) throws IOException {
        vehicleMessageDailyService.exportOfflineVehicle(para,response);
    }

    @Tag(name = "v1.0")
    @Operation(summary = "查询所有车辆的经纬度")
    @PostMapping("/getAllVehicleLocation")
    @Log(title = "全局监控-查询所有车辆的经纬度", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R<VehicleMap> getAllVehicleLocation(@RequestBody @Validated QueryVehicleMap para){
        return R.ok(vehicleMessageDailyService.getAllVehicleLocation(para));
    }

    /*@Tag(name = "v1.0")
    @Operation(summary = "查询所有车辆的经纬度")
    @PostMapping("/getAllVehicleLocationPage")
    @Log(title = "全局监控-查询所有车辆的经纬度", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public TableDataInfo<VehicleMap> getAllVehicleLocationPage(@RequestBody @Validated PageModelNew pageModel){
        return vehicleMessageDailyService.getAllVehicleLocationPage(pageModel);
    }*/


}
